byteCodes = new File("bytecode_2.txt")
A = []
B = []
C = []
D = []
E = []
byteCodes.eachLine {
  if (!it.startsWith("#")) {
    line = it.split(" ")
    if (line[0] == "A") A.add([op:line[1], name:line[2]])
    if (line[0] == "B") B.add([op:line[1], name:line[2]])
    if (line[0] == "C") C.add([op:line[1], name:line[2]])
    if (line[0] == "D") D.add([op:line[1], name:line[2]])
    if (line[0] == "E") E.add([op:line[1], name:line[2]])
   }
}

A.each {
  println """case (byte) ${it.op}:  // ${it.name}"""
}
println """    return new LocalIndexInstruction(opCode, bytes, offset);"""

B.each {
 println """case (byte) ${it.op}: // ${it.name}"""
}
println """    return new ConstantPoolIndexInstruction(opCode, bytes, offset);"""

C.each {
 println """case (byte) ${it.op}: // ${it.name}"""
}
println """    return new DoubleByteInstruction(opCode, bytes, offset);"""

D.each {
 println """case (byte) ${it.op}: // ${it.name}"""
}
println """    return new FourByteInstruction(opCode, bytes, offset);"""

println """//special cases"""

E.each {
  println """case (byte) ${it.op}: """
  println """ return new ${it.name.toUpperCase()}(bytes, offset);"""
}